diff --git a/gosnappi/bgp_attributes_community.go b/gosnappi/bgp_attributes_community.go index 7fa809f5..6121cba8 100644 --- a/gosnappi/bgp_attributes_community.go +++ b/gosnappi/bgp_attributes_community.go @@ -278,16 +278,16 @@ type BgpAttributesCommunity interface { Choice() BgpAttributesCommunityChoiceEnum // setChoice assigns BgpAttributesCommunityChoiceEnum provided by user to BgpAttributesCommunity setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity - // getter for LlgrStale to set choice. - LlgrStale() - // getter for NoExportSubconfed to set choice. - NoExportSubconfed() // getter for NoAdvertised to set choice. NoAdvertised() - // getter for NoLlgr to set choice. - NoLlgr() // getter for NoExport to set choice. NoExport() + // getter for LlgrStale to set choice. + LlgrStale() + // getter for NoLlgr to set choice. + NoLlgr() + // getter for NoExportSubconfed to set choice. + NoExportSubconfed() // 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 @@ -322,19 +322,19 @@ func (obj *bgpAttributesCommunity) Choice() BgpAttributesCommunityChoiceEnum { return BgpAttributesCommunityChoiceEnum(obj.obj.Choice.Enum().String()) } -// 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 NoExportSubconfed to set choice -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 @@ -342,9 +342,9 @@ func (obj *bgpAttributesCommunity) NoLlgr() { obj.setChoice(BgpAttributesCommunityChoice.NO_LLGR) } -// getter for NoExport to set choice -func (obj *bgpAttributesCommunity) NoExport() { - obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT) +// getter for NoExportSubconfed to set choice +func (obj *bgpAttributesCommunity) NoExportSubconfed() { + obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED) } func (obj *bgpAttributesCommunity) setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity { diff --git a/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go b/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go index 009bcaab..11e1830f 100644 --- a/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go +++ b/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go @@ -272,12 +272,12 @@ type BgpAttributesSrPolicyExplicitNullPolicy interface { setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy // HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy HasChoice() bool - // getter for PushIpv6 to set choice. - PushIpv6() // getter for Unknown to set choice. Unknown() // getter for DonotPush to set choice. DonotPush() + // getter for PushIpv6 to set choice. + PushIpv6() // getter for PushIpv4 to set choice. PushIpv4() // getter for PushIpv4AndIpv6 to set choice. @@ -305,11 +305,6 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPoli return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String()) } -// getter for PushIpv6 to set choice -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv6() { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV6) -} - // getter for Unknown to set choice func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unknown() { obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.UNKNOWN) @@ -320,6 +315,11 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) DonotPush() { obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.DONOT_PUSH) } +// getter for PushIpv6 to set choice +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv6() { + obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV6) +} + // getter for PushIpv4 to set choice func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4() { obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4) diff --git a/gosnappi/flow_rsvp_record_route_i_pv4_flag.go b/gosnappi/flow_rsvp_record_route_i_pv4_flag.go index ae4873ee..8ec9fad0 100644 --- a/gosnappi/flow_rsvp_record_route_i_pv4_flag.go +++ b/gosnappi/flow_rsvp_record_route_i_pv4_flag.go @@ -270,10 +270,10 @@ type FlowRSVPRecordRouteIPv4Flag interface { setChoice(value FlowRSVPRecordRouteIPv4FlagChoiceEnum) FlowRSVPRecordRouteIPv4Flag // HasChoice checks if Choice has been set in FlowRSVPRecordRouteIPv4Flag HasChoice() bool - // getter for LocalProtectionInUse to set choice. - LocalProtectionInUse() // getter for LocalProtectionAvailable to set choice. LocalProtectionAvailable() + // getter for LocalProtectionInUse to set choice. + LocalProtectionInUse() } type FlowRSVPRecordRouteIPv4FlagChoiceEnum string @@ -291,16 +291,16 @@ func (obj *flowRSVPRecordRouteIPv4Flag) Choice() FlowRSVPRecordRouteIPv4FlagChoi return FlowRSVPRecordRouteIPv4FlagChoiceEnum(obj.obj.Choice.Enum().String()) } -// getter for LocalProtectionInUse to set choice -func (obj *flowRSVPRecordRouteIPv4Flag) LocalProtectionInUse() { - obj.setChoice(FlowRSVPRecordRouteIPv4FlagChoice.LOCAL_PROTECTION_IN_USE) -} - // getter for LocalProtectionAvailable to set choice func (obj *flowRSVPRecordRouteIPv4Flag) LocalProtectionAvailable() { obj.setChoice(FlowRSVPRecordRouteIPv4FlagChoice.LOCAL_PROTECTION_AVAILABLE) } +// getter for LocalProtectionInUse to set choice +func (obj *flowRSVPRecordRouteIPv4Flag) LocalProtectionInUse() { + obj.setChoice(FlowRSVPRecordRouteIPv4FlagChoice.LOCAL_PROTECTION_IN_USE) +} + // description is TBD // Choice returns a string func (obj *flowRSVPRecordRouteIPv4Flag) HasChoice() bool { diff --git a/gosnappi/m_ac_route_address.go b/gosnappi/m_ac_route_address.go deleted file mode 100644 index a8ba2865..00000000 --- a/gosnappi/m_ac_route_address.go +++ /dev/null @@ -1,434 +0,0 @@ -package gosnappi - -import ( - "fmt" - "strings" - - "github.com/ghodss/yaml" - otg "github.com/open-traffic-generator/snappi/gosnappi/otg" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/proto" -) - -// ***** MACRouteAddress ***** -type mACRouteAddress struct { - validation - obj *otg.MACRouteAddress - marshaller marshalMACRouteAddress - unMarshaller unMarshalMACRouteAddress -} - -func NewMACRouteAddress() MACRouteAddress { - obj := mACRouteAddress{obj: &otg.MACRouteAddress{}} - obj.setDefault() - return &obj -} - -func (obj *mACRouteAddress) msg() *otg.MACRouteAddress { - return obj.obj -} - -func (obj *mACRouteAddress) setMsg(msg *otg.MACRouteAddress) MACRouteAddress { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalmACRouteAddress struct { - obj *mACRouteAddress -} - -type marshalMACRouteAddress interface { - // ToProto marshals MACRouteAddress to protobuf object *otg.MACRouteAddress - ToProto() (*otg.MACRouteAddress, error) - // ToPbText marshals MACRouteAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals MACRouteAddress to YAML text - ToYaml() (string, error) - // ToJson marshals MACRouteAddress to JSON text - ToJson() (string, error) -} - -type unMarshalmACRouteAddress struct { - obj *mACRouteAddress -} - -type unMarshalMACRouteAddress interface { - // FromProto unmarshals MACRouteAddress from protobuf object *otg.MACRouteAddress - FromProto(msg *otg.MACRouteAddress) (MACRouteAddress, error) - // FromPbText unmarshals MACRouteAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals MACRouteAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals MACRouteAddress from JSON text - FromJson(value string) error -} - -func (obj *mACRouteAddress) Marshal() marshalMACRouteAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalmACRouteAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *mACRouteAddress) Unmarshal() unMarshalMACRouteAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalmACRouteAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalmACRouteAddress) ToProto() (*otg.MACRouteAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalmACRouteAddress) FromProto(msg *otg.MACRouteAddress) (MACRouteAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalmACRouteAddress) ToPbText() (string, error) { - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return "", vErr - } - protoMarshal, err := proto.Marshal(m.obj.msg()) - if err != nil { - return "", err - } - return string(protoMarshal), nil -} - -func (m *unMarshalmACRouteAddress) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalmACRouteAddress) ToYaml() (string, error) { - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return "", vErr - } - opts := protojson.MarshalOptions{ - UseProtoNames: true, - AllowPartial: true, - EmitUnpopulated: false, - } - data, err := opts.Marshal(m.obj.msg()) - if err != nil { - return "", err - } - data, err = yaml.JSONToYAML(data) - if err != nil { - return "", err - } - return string(data), nil -} - -func (m *unMarshalmACRouteAddress) FromYaml(value string) error { - if value == "" { - value = "{}" - } - data, err := yaml.YAMLToJSON([]byte(value)) - if err != nil { - return err - } - opts := protojson.UnmarshalOptions{ - AllowPartial: true, - DiscardUnknown: false, - } - uError := opts.Unmarshal([]byte(data), m.obj.msg()) - if uError != nil { - return fmt.Errorf("unmarshal error %s", strings.Replace( - uError.Error(), "\u00a0", " ", -1)[7:]) - } - - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalmACRouteAddress) ToJson() (string, error) { - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return "", vErr - } - opts := protojson.MarshalOptions{ - UseProtoNames: true, - AllowPartial: true, - EmitUnpopulated: false, - Indent: " ", - } - data, err := opts.Marshal(m.obj.msg()) - if err != nil { - return "", err - } - return string(data), nil -} - -func (m *unMarshalmACRouteAddress) FromJson(value string) error { - opts := protojson.UnmarshalOptions{ - AllowPartial: true, - DiscardUnknown: false, - } - if value == "" { - value = "{}" - } - uError := opts.Unmarshal([]byte(value), m.obj.msg()) - if uError != nil { - return fmt.Errorf("unmarshal error %s", strings.Replace( - uError.Error(), "\u00a0", " ", -1)[7:]) - } - - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *mACRouteAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *mACRouteAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *mACRouteAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *mACRouteAddress) Clone() (MACRouteAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewMACRouteAddress() - data, err := proto.Marshal(obj.msg()) - if err != nil { - return nil, err - } - pbErr := proto.Unmarshal(data, newObj.msg()) - if pbErr != nil { - return nil, pbErr - } - return newObj, nil -} - -// MACRouteAddress is a container for MAC route addresses. -type MACRouteAddress interface { - Validation - // msg marshals MACRouteAddress to protobuf object *otg.MACRouteAddress - // and doesn't set defaults - msg() *otg.MACRouteAddress - // setMsg unmarshals MACRouteAddress from protobuf object *otg.MACRouteAddress - // and doesn't set defaults - setMsg(*otg.MACRouteAddress) MACRouteAddress - // provides marshal interface - Marshal() marshalMACRouteAddress - // provides unmarshal interface - Unmarshal() unMarshalMACRouteAddress - // validate validates MACRouteAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (MACRouteAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in MACRouteAddress. - Address() string - // SetAddress assigns string provided by user to MACRouteAddress - SetAddress(value string) MACRouteAddress - // Prefix returns uint32, set in MACRouteAddress. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to MACRouteAddress - SetPrefix(value uint32) MACRouteAddress - // HasPrefix checks if Prefix has been set in MACRouteAddress - HasPrefix() bool - // Count returns uint32, set in MACRouteAddress. - Count() uint32 - // SetCount assigns uint32 provided by user to MACRouteAddress - SetCount(value uint32) MACRouteAddress - // HasCount checks if Count has been set in MACRouteAddress - HasCount() bool - // Step returns uint32, set in MACRouteAddress. - Step() uint32 - // SetStep assigns uint32 provided by user to MACRouteAddress - SetStep(value uint32) MACRouteAddress - // HasStep checks if Step has been set in MACRouteAddress - HasStep() bool -} - -// The starting address of the MAC Range. -// Address returns a string -func (obj *mACRouteAddress) Address() string { - - return *obj.obj.Address - -} - -// The starting address of the MAC Range. -// SetAddress sets the string value in the MACRouteAddress object -func (obj *mACRouteAddress) SetAddress(value string) MACRouteAddress { - - obj.obj.Address = &value - return obj -} - -// The MAC prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *mACRouteAddress) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The MAC prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *mACRouteAddress) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The MAC prefix length to be applied to the address. -// SetPrefix sets the uint32 value in the MACRouteAddress object -func (obj *mACRouteAddress) SetPrefix(value uint32) MACRouteAddress { - - obj.obj.Prefix = &value - return obj -} - -// The total number of mac addresses in the range. -// Count returns a uint32 -func (obj *mACRouteAddress) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of mac addresses in the range. -// Count returns a uint32 -func (obj *mACRouteAddress) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of mac addresses in the range. -// SetCount sets the uint32 value in the MACRouteAddress object -func (obj *mACRouteAddress) SetCount(value uint32) MACRouteAddress { - - obj.obj.Count = &value - return obj -} - -// Increments the mac address prefixes within a mac range where multiple routes are present. The value is incremented according to the mac prefix Length and Step. -// Step returns a uint32 -func (obj *mACRouteAddress) Step() uint32 { - - return *obj.obj.Step - -} - -// Increments the mac address prefixes within a mac range where multiple routes are present. The value is incremented according to the mac prefix Length and Step. -// Step returns a uint32 -func (obj *mACRouteAddress) HasStep() bool { - return obj.obj.Step != nil -} - -// Increments the mac address prefixes within a mac range where multiple routes are present. The value is incremented according to the mac prefix Length and Step. -// SetStep sets the uint32 value in the MACRouteAddress object -func (obj *mACRouteAddress) SetStep(value uint32) MACRouteAddress { - - obj.obj.Step = &value - return obj -} - -func (obj *mACRouteAddress) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Address is required - if obj.obj.Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "Address is required field on interface MACRouteAddress") - } - if obj.obj.Address != nil { - - err := obj.validateMac(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on MACRouteAddress.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= MACRouteAddress.Prefix <= 48 but Got %d", *obj.obj.Prefix)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count < 1 || *obj.obj.Count > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= MACRouteAddress.Count <= 4294967295 but Got %d", *obj.obj.Count)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step < 1 || *obj.obj.Step > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= MACRouteAddress.Step <= 4294967295 but Got %d", *obj.obj.Step)) - } - - } - -} - -func (obj *mACRouteAddress) setDefault() { - if obj.obj.Prefix == nil { - obj.SetPrefix(48) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - -} diff --git a/gosnappi/metrics_response.go b/gosnappi/metrics_response.go index 7719521c..78ddd4bd 100644 --- a/gosnappi/metrics_response.go +++ b/gosnappi/metrics_response.go @@ -298,10 +298,10 @@ type MetricsResponse interface { setChoice(value MetricsResponseChoiceEnum) MetricsResponse // HasChoice checks if Choice has been set in MetricsResponse HasChoice() bool - // getter for Dhcpv4Server to set choice. - Dhcpv4Server() // getter for Dhcpv4Client to set choice. Dhcpv4Client() + // getter for Dhcpv4Server to set choice. + Dhcpv4Server() // PortMetrics returns MetricsResponsePortMetricIterIter, set in MetricsResponse PortMetrics() MetricsResponsePortMetricIter // FlowMetrics returns MetricsResponseFlowMetricIterIter, set in MetricsResponse @@ -360,16 +360,16 @@ func (obj *metricsResponse) Choice() MetricsResponseChoiceEnum { return MetricsResponseChoiceEnum(obj.obj.Choice.Enum().String()) } -// getter for Dhcpv4Server to set choice -func (obj *metricsResponse) Dhcpv4Server() { - obj.setChoice(MetricsResponseChoice.DHCPV4_SERVER) -} - // getter for Dhcpv4Client to set choice func (obj *metricsResponse) Dhcpv4Client() { obj.setChoice(MetricsResponseChoice.DHCPV4_CLIENT) } +// getter for Dhcpv4Server to set choice +func (obj *metricsResponse) Dhcpv4Server() { + obj.setChoice(MetricsResponseChoice.DHCPV4_SERVER) +} + // description is TBD // Choice returns a string func (obj *metricsResponse) HasChoice() bool { diff --git a/requirements.txt b/requirements.txt index 468e4bd8..0e869d33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ --prefer-binary -grpcio-tools~=1.59.0 ; python_version > '3.6' +requests +PyYAML grpcio-tools~=1.35.0 ; python_version <= '3.6' +grpcio-tools~=1.59.0 ; python_version > '3.6' grpcio~=1.59.0 ; python_version > '3.6' grpcio~=1.35.0 ; python_version <= '3.6' -PyYAML -requests -protobuf~=4.24.4 ; python_version > '3.6' protobuf~=3.15.0 ; python_version <= '3.6' -semantic_version +protobuf~=4.24.4 ; python_version > '3.6' urllib3 +semantic_version