Skip to content

Commit

Permalink
Go upgrade infra for latest 3 go releases (#229)
Browse files Browse the repository at this point in the history
* pointing to dev openapiart branch

* Update auto generated go snappi

* fix typo

* Update auto generated go snappi

* update openapiart

* Update auto generated go snappi

---------

Co-authored-by: Github Actions Bot <[email protected]>
  • Loading branch information
Vibaswan and actions-user authored Sep 6, 2024
1 parent 6f15c7e commit 747ae2b
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 156 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--prefer-binary
requests
openapiart==0.3.20
openapiart==0.3.21
3 changes: 2 additions & 1 deletion do.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


BLACK_VERSION = "22.1.0"
GO_VERSION = "1.20"
GO_VERSION = "1.21.0"
PROTOC_VERSION = "3.20.3"

# this is where go and protoc shall be installed (and expected to be present)
Expand Down Expand Up @@ -330,6 +330,7 @@ def testgo():
# TODO: not able to run the test from main directory
os.chdir("gosnappi")
try:
run(["go version"], raise_exception=True, msg="could not fetch go version")
run(
["go test ./... -v -coverprofile coverage.txt | tee coverage.out"],
raise_exception=True,
Expand Down
34 changes: 17 additions & 17 deletions gosnappi/bgp_attributes_community.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ type BgpAttributesCommunity interface {
setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity
// getter for NoExportSubconfed to set choice.
NoExportSubconfed()
// getter for NoExport to set choice.
NoExport()
// getter for NoAdvertised to set choice.
NoAdvertised()
// getter for NoLlgr to set choice.
NoLlgr()
// getter for LlgrStale to set choice.
LlgrStale()
// getter for NoLlgr to set choice.
NoLlgr()
// getter for NoAdvertised to set choice.
NoAdvertised()
// getter for NoExport to set choice.
NoExport()
// CustomCommunity returns BgpAttributesCustomCommunity, set in BgpAttributesCommunity.
// BgpAttributesCustomCommunity is user defined COMMUNITY attribute containing 2 byte AS and custom 2 byte value defined by the administrator of the domain.
CustomCommunity() BgpAttributesCustomCommunity
Expand Down Expand Up @@ -327,24 +327,24 @@ func (obj *bgpAttributesCommunity) NoExportSubconfed() {
obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED)
}

// getter for NoExport to set choice
func (obj *bgpAttributesCommunity) NoExport() {
obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT)
}

// getter for NoAdvertised to set choice
func (obj *bgpAttributesCommunity) NoAdvertised() {
obj.setChoice(BgpAttributesCommunityChoice.NO_ADVERTISED)
// getter for LlgrStale to set choice
func (obj *bgpAttributesCommunity) LlgrStale() {
obj.setChoice(BgpAttributesCommunityChoice.LLGR_STALE)
}

// getter for NoLlgr to set choice
func (obj *bgpAttributesCommunity) NoLlgr() {
obj.setChoice(BgpAttributesCommunityChoice.NO_LLGR)
}

// getter for LlgrStale to set choice
func (obj *bgpAttributesCommunity) LlgrStale() {
obj.setChoice(BgpAttributesCommunityChoice.LLGR_STALE)
// getter for NoAdvertised to set choice
func (obj *bgpAttributesCommunity) NoAdvertised() {
obj.setChoice(BgpAttributesCommunityChoice.NO_ADVERTISED)
}

// getter for NoExport to set choice
func (obj *bgpAttributesCommunity) NoExport() {
obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT)
}

func (obj *bgpAttributesCommunity) setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity {
Expand Down
34 changes: 17 additions & 17 deletions gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,16 @@ type BgpAttributesSrPolicyExplicitNullPolicy interface {
setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy
// HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy
HasChoice() bool
// getter for PushIpv4AndIpv6 to set choice.
PushIpv4AndIpv6()
// getter for PushIpv4 to set choice.
PushIpv4()
// getter for PushIpv6 to set choice.
PushIpv6()
// getter for Unknown to set choice.
Unknown()
// getter for DonotPush to set choice.
DonotPush()
// getter for PushIpv4AndIpv6 to set choice.
PushIpv4AndIpv6()
// getter for Unknown to set choice.
Unknown()
// getter for PushIpv6 to set choice.
PushIpv6()
}

type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string
Expand All @@ -305,29 +305,29 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPoli
return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String())
}

// getter for PushIpv4AndIpv6 to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4AndIpv6() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4_AND_IPV6)
}

// getter for PushIpv4 to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4)
}

// getter for PushIpv6 to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv6() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV6)
// getter for DonotPush to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) DonotPush() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.DONOT_PUSH)
}

// getter for PushIpv4AndIpv6 to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4AndIpv6() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4_AND_IPV6)
}

// getter for Unknown to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unknown() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.UNKNOWN)
}

// getter for DonotPush to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) DonotPush() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.DONOT_PUSH)
// getter for PushIpv6 to set choice
func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv6() {
obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV6)
}

// The Explicit NULL Label policy.
Expand Down
28 changes: 14 additions & 14 deletions gosnappi/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (obj *validation) validationResult() error {
if len(obj.validationErrors) > 0 {
errors := strings.Join(obj.validationErrors, "\n")
obj.validationErrors = nil
return fmt.Errorf(errors)
return fmt.Errorf("%s", errors)
}
return nil
}
Expand Down Expand Up @@ -257,13 +257,13 @@ func (obj *validation) under_review(message string) {
func (obj *validation) validateMac(mac string) error {
macSlice := strings.Split(mac, ":")
if len(macSlice) != 6 {
return fmt.Errorf(fmt.Sprintf("Invalid Mac address %s", mac))
return fmt.Errorf("Invalid Mac address %s", mac)
}
octInd := []string{"0th", "1st", "2nd", "3rd", "4th", "5th"}
for ind, val := range macSlice {
num, err := strconv.ParseUint(val, 16, 32)
if err != nil || num > 255 {
return fmt.Errorf(fmt.Sprintf("Invalid Mac address at %s octet in %s mac", octInd[ind], mac))
return fmt.Errorf("Invalid Mac address at %s octet in %s mac", octInd[ind], mac)
}
}
return nil
Expand All @@ -272,13 +272,13 @@ func (obj *validation) validateMac(mac string) error {
func (obj *validation) validateIpv4(ip string) error {
ipSlice := strings.Split(ip, ".")
if len(ipSlice) != 4 {
return fmt.Errorf(fmt.Sprintf("Invalid Ipv4 address %s", ip))
return fmt.Errorf("Invalid Ipv4 address %s", ip)
}
octInd := []string{"1st", "2nd", "3rd", "4th"}
for ind, val := range ipSlice {
num, err := strconv.ParseUint(val, 10, 32)
if err != nil || num > 255 {
return fmt.Errorf(fmt.Sprintf("Invalid Ipv4 address at %s octet in %s ipv4", octInd[ind], ip))
return fmt.Errorf("Invalid Ipv4 address at %s octet in %s ipv4", octInd[ind], ip)
}
}
return nil
Expand All @@ -289,13 +289,13 @@ func (obj *validation) validateIpv6(ip string) error {
if strings.Count(ip, " ") > 0 || strings.Count(ip, ":") > 7 ||
strings.Count(ip, "::") > 1 || strings.Count(ip, ":::") > 0 ||
strings.Count(ip, ":") == 0 {
return fmt.Errorf(fmt.Sprintf("Invalid ipv6 address %s", ip))
return fmt.Errorf("Invalid ipv6 address %s", ip)
}
if (string(ip[0]) == ":" && string(ip[:2]) != "::") || (string(ip[len(ip)-1]) == ":" && string(ip[len(ip)-2:]) != "::") {
return fmt.Errorf(fmt.Sprintf("Invalid ipv6 address %s", ip))
return fmt.Errorf("Invalid ipv6 address %s", ip)
}
if strings.Count(ip, "::") == 0 && strings.Count(ip, ":") != 7 {
return fmt.Errorf(fmt.Sprintf("Invalid ipv6 address %s", ip))
return fmt.Errorf("Invalid ipv6 address %s", ip)
}
if ip == "::" {
return nil
Expand All @@ -317,7 +317,7 @@ func (obj *validation) validateIpv6(ip string) error {
for ind, val := range ipSlice {
num, err := strconv.ParseUint(val, 16, 64)
if err != nil || num > 65535 {
return fmt.Errorf(fmt.Sprintf("Invalid Ipv6 address at %s octet in %s ipv6", octInd[ind], ip))
return fmt.Errorf("Invalid Ipv6 address at %s octet in %s ipv6", octInd[ind], ip)
}
}

Expand All @@ -327,21 +327,21 @@ func (obj *validation) validateIpv6(ip string) error {
func (obj *validation) validateHex(hex string) error {
matched, err := regexp.MatchString(`^[0-9a-fA-F]+$|^0[x|X][0-9a-fA-F]+$`, hex)
if err != nil || !matched {
return fmt.Errorf(fmt.Sprintf("Invalid hex value %s", hex))
return fmt.Errorf("Invalid hex value %s", hex)
}
return nil
}

func (obj *validation) validateOid(oid string) error {
segments := strings.Split(oid, ".")
if len(segments) < 2 {
return fmt.Errorf(fmt.Sprintf("Invalid oid value %s", oid))
return fmt.Errorf("Invalid oid value %s", oid)
}

for _, segment := range segments {
_, err := strconv.ParseUint(segment, 10, 32)
if err != nil {
return fmt.Errorf(fmt.Sprintf("Invalid oid value %s", oid))
return fmt.Errorf("Invalid oid value %s", oid)
}
}
return nil
Expand All @@ -363,7 +363,7 @@ func (obj *validation) validateSlice(valSlice []string, sliceType string) error
} else if sliceType == "oid" {
err = obj.validateOid(val)
} else {
return fmt.Errorf(fmt.Sprintf("Invalid slice type received <%s>", sliceType))
return fmt.Errorf("Invalid slice type received <%s>", sliceType)
}

if err != nil {
Expand All @@ -372,7 +372,7 @@ func (obj *validation) validateSlice(valSlice []string, sliceType string) error
}
if len(indices) > 0 {
return fmt.Errorf(
fmt.Sprintf("Invalid %s addresses at indices %s", sliceType, strings.Join(indices, ",")),
"Invalid %s addresses at indices %s", sliceType, strings.Join(indices, ","),
)
}
return nil
Expand Down
14 changes: 7 additions & 7 deletions gosnappi/dhcpv6_client_options_duid_uuid_variant.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ type Dhcpv6ClientOptionsDuidUuidVariant interface {
setChoice(value Dhcpv6ClientOptionsDuidUuidVariantChoiceEnum) Dhcpv6ClientOptionsDuidUuidVariant
// HasChoice checks if Choice has been set in Dhcpv6ClientOptionsDuidUuidVariant
HasChoice() bool
// getter for Guid to set choice.
Guid()
// getter for Dce to set choice.
Dce()
// getter for VarReserved to set choice.
VarReserved()
// getter for Ncs to set choice.
Ncs()
// getter for Guid to set choice.
Guid()
}

type Dhcpv6ClientOptionsDuidUuidVariantChoiceEnum string
Expand All @@ -299,11 +299,6 @@ func (obj *dhcpv6ClientOptionsDuidUuidVariant) Choice() Dhcpv6ClientOptionsDuidU
return Dhcpv6ClientOptionsDuidUuidVariantChoiceEnum(obj.obj.Choice.Enum().String())
}

// getter for Guid to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVariant) Guid() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVariantChoice.GUID)
}

// getter for Dce to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVariant) Dce() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVariantChoice.DCE)
Expand All @@ -319,6 +314,11 @@ func (obj *dhcpv6ClientOptionsDuidUuidVariant) Ncs() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVariantChoice.NCS)
}

// getter for Guid to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVariant) Guid() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVariantChoice.GUID)
}

// The current variants are ncs, dce,microsoft guid and reserved.
// Choice returns a string
func (obj *dhcpv6ClientOptionsDuidUuidVariant) HasChoice() bool {
Expand Down
20 changes: 10 additions & 10 deletions gosnappi/dhcpv6_client_options_duid_uuid_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ type Dhcpv6ClientOptionsDuidUuidVersion interface {
V_5()
// getter for V_4 to set choice.
V_4()
// getter for V_1 to set choice.
V_1()
// getter for V_3 to set choice.
V_3()
// getter for V_2 to set choice.
V_2()
// getter for V_3 to set choice.
V_3()
// getter for V_1 to set choice.
V_1()
}

type Dhcpv6ClientOptionsDuidUuidVersionChoiceEnum string
Expand Down Expand Up @@ -313,19 +313,19 @@ func (obj *dhcpv6ClientOptionsDuidUuidVersion) V_4() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVersionChoice.V_4)
}

// getter for V_1 to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVersion) V_1() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVersionChoice.V_1)
// getter for V_2 to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVersion) V_2() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVersionChoice.V_2)
}

// getter for V_3 to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVersion) V_3() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVersionChoice.V_3)
}

// getter for V_2 to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVersion) V_2() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVersionChoice.V_2)
// getter for V_1 to set choice
func (obj *dhcpv6ClientOptionsDuidUuidVersion) V_1() {
obj.setChoice(Dhcpv6ClientOptionsDuidUuidVersionChoice.V_1)
}

// The version values are from 1 to 5 in the most significant 4 bits of the timestamp (bits 4 through 7 of the time_hi_and_version field).
Expand Down
Loading

0 comments on commit 747ae2b

Please sign in to comment.